forum

home / developersection / forums / charat() and substring method in java

charAt() and substring method in java

Anonymous User 2411 10-Oct-2014
I want to go through each character in a String and pass each character of the String as a String to another function.
String s = "abcdefg";
for (int i = 0; i < s.length(); i++)
{
      newFunction(s.substring(i, i + 1));
}

or

String s = "abcdefg";
for (int i = 0; i < s.length(); i++)
{
       newFunction(Character.toString(s.charAt(i)));
}


java java  oops 
Updated on 10-Oct-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By